import rentadomus.IdentificationType
import rentadomus.IdentificationType
import rentadomus.Person
import rentadomus.Place
import rentadomus.Warehouse
import rentadomus.Contract


class BootStrap {

    def init = { servletContext ->
        def cc=new IdentificationType(name:"Cedula",acronym:"CC", description:"cedula de ciudadania")
        cc.save()
        new IdentificationType(name:"Cedula Extranjero",acronym:"CE", description:"cedula de extranjeria").save()
        new IdentificationType(name:"Tarjeta",acronym:"TI", description:"tarjeta de identidad").save()
        new IdentificationType(name:"Registro",acronym:"RC", description:"registro civil").save()
        new IdentificationType(name:"Pasaporte",acronym:"PA", description:"pasaporte").save()
        Person p=new Person(
            identification:"6",
            name:"Jairo",
            lastName:"Aponte",
            email:"profesor@unal",
            address:"Fake St 123",
            username:"1",
            password:"1",
            identificationType:cc
        ).save(flush: true)
        Place place=new Place(
            idPerson:p,
            titlePlace:"Cute WareHouse",
            address:"Evergreen St 742",
            neighborhood:"Springfield",
            strata:2,
            price:100,
            area:72,
            description:"Cute place!",
            energy:true,
            water:false,
            gas:false,
            wifi:false,
            phone:false,
            cableTv:false
        ).save(flush: true)
        Warehouse w=new Warehouse(
            idPlace:place,
            warehouseType:"Other",
            hasOffice:true
        ).save(flush: true)
    }
    
    def destroy = {
        
    }
}
